package entities;

import java.util.ArrayList;
import java.util.List;

import applicationutil.ApplicationConstant;
import applicationutil.ApplicationUtil;

/*
 * luu tach ca cac key search
 */
public class KeySeacher {
	private List<Key> listKeys = new ArrayList<Key>();
	private String normalKey;
	private String noAccentKey;// key bo het dau
	private String tokenKey;// field tach tu
	private String noAccentTokenKey;// field bo het dau sau do tach tu
	private String webSiteSearch;// tim chinh xac website nao
	private String notText;//tu khong muon tim thay
	private int mode;// 1: search binh thuong, 2 search chinh xác

	public KeySeacher(String key, int mode, String webSiteSearch, String notText) {
		// TODO Auto-generated constructor stub
		this.mode = mode;
		this.webSiteSearch = ApplicationUtil.getTextUrlForIndex(webSiteSearch);
		this.notText=notText;
		normalKey=key;
		// query search chinh xac k theo website
		System.out.println("--tu bt:" + normalKey);
		noAccentKey = ApplicationUtil.removeAccent(key);
		System.out.println("---tu bo het dau:" + noAccentKey);
		tokenKey = ApplicationUtil.getToken(key);
		System.out.println("----da tach tu:" + tokenKey);
		String text = ApplicationUtil.removeAccent(key);
		noAccentTokenKey = ApplicationUtil.getToken(ApplicationUtil
				.addAccent(text));
		System.out.println("---bo dau->them dau->tach tu:" + noAccentTokenKey);
		/*
		 * add to list key
		 */
		listKeys.add(new Key(tokenKey,
				ApplicationConstant.MYPAGE_FIELD_TEXT_TOKEN));
		listKeys.add(new Key(noAccentTokenKey,
				ApplicationConstant.MYPAGE_FIELD_TEXT_TOKEN));
		listKeys.add(new Key(normalKey, ApplicationConstant.MYPAGE_FIELD_TEXT));
		listKeys.add(new Key(noAccentKey,
				ApplicationConstant.MYPAGE_FIELD_TEXT_NO_ACCENT));

	}

	/*
	 * ham tra ve mang cac chuoi can tim de search
	 */

	public String getNormalKey() {
		return normalKey;
	}

	public void setNormalKey(String normalKey) {
		this.normalKey = normalKey;
	}

	public String getNoAccentKey() {
		return noAccentKey;
	}

	public void setNoAccentKey(String noAccentKey) {
		this.noAccentKey = noAccentKey;
	}

	public String getTokenKey() {
		return tokenKey;
	}

	public void setTokenKey(String tokenKey) {
		this.tokenKey = tokenKey;
	}

	public String getNoAccentTokenKey() {
		return noAccentTokenKey;
	}

	public void setNoAccentTokenKey(String noAccentTokenKey) {
		this.noAccentTokenKey = noAccentTokenKey;
	}

	public List<Key> getListKeys() {
		return listKeys;
	}

	public void setListKeys(List<Key> listKeys) {
		this.listKeys = listKeys;
	}

	public String getWebSiteSearch() {
		return webSiteSearch;
	}

	

	public void setWebSiteSearch(String webSiteSearch) {
		this.webSiteSearch = webSiteSearch;
	}

	public int getMode() {
		return mode;
	}

	public void setMode(int mode) {
		this.mode = mode;
	}

	public String getNotText() {
		return notText;
	}

	public void setNotText(String notText) {
		this.notText = notText;
	}
	
}	
